<?php
/**
 * Created by JetBrains PhpStorm.
 * User: joel
 * Date: 12/22/12
 * Time: 11:48 PM
 * To change this template use File | Settings | File Templates.
 */
class JobeetTestFunctional extends sfTestFunctional
{
    public function loadData() {
        Doctrine_Core::loadData(sfConfig::get('sf_test_dir').'/fixtures');
        return $this;
    }

    public function getMostRecentProgrammingJob() {
        $q = Doctrine_Query::create()
            ->select('j.*')
            ->from('JobeetJob j')
            ->leftJoin('j.JobeetCategory c')
                ->where('c.slug = ?', 'programming');
        $q = Doctrine_Core::getTable('JobeetJob')->addActiveJobsQuery($q);
        return $q->fetchOne();
    }

    public function getExpiredJob() {
        $q = Doctrine_Query::create()
            ->from('JobeetJob j')
            ->where('j.expires_at < ?', date('Y-m-d', time()));
        return $q->fetchOne();
    }

}
